class Solution {
    public int findRepeatNumber(int[] nums) {
        for(int i = 0; i < nums.length; i++) {
            int value = nums[i];
            if(value != i) {
                if(nums[value] == value) {
                    return value;
                }
                else {
                    int temp = nums[value];
                    nums[value] = value;
                    nums[i] = temp;
                }
            }
        }
        return -1;
    }
}